<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<!DOCTYPE html>
<html>
 <head>
  <title>实验室仪器</title>
  <t:base type="jquery,easyui,tools,DatePicker"></t:base>
 </head>
 <body>
  <t:formvalid formid="formobj" dialog="true"  layout="table" tiptype="3" >
		<input id="id" name="id" type="hidden" value="${device.id }">
		<table style="" cellpadding="0" cellspacing="1" class="formtable"> 
				<tr>
					<td align="right">
						<label class="Validform_label">
							机床名称:
						</label>
					</td>
					<td class="value">
						<input id="machineName" value='${device.machineName }'  name="name" type="text" style="width: 100px" class="inputxt" >
						  	  
					</td>
				</tr>	
				<tr>
					<td align="right">
						<label class="Validform_label">
							机床编号:
						</label>
					</td>
					<td class="value"> 
                	     <input id="machineNo" name="machineNo" type="text"  value="${device.machineNo}"
					     	style="width: 250px" class="inputxt"   maxlength="30"  onkeypress="specialTextValidate()">
							
						<span class="Validform_checktip"></span>
						<label class="Validform_label" style="display: none;">机床编号</label>
						
					</td>
					
				</tr>
				<tr>
					<td align="right">
						<label class="Validform_label">
							负责教师:
						</label>
					</td>
					<td class="value"> 
                	     <input id="teacherId" name="teacherId" type="hidden"  value='${device.teacher.id }'>               
					     <input id="realName"  type="text" style="width: 150px" class="inputxt" 
					      readonly="readonly" datatype="*" value='${device.teacher.realName}'>
					     <t:choose hiddenName="teacherId" hiddenid="id" url="teacherController.do?goSelect" name="teacherList"
                          icon="icon-search" title="选择" textname="realName" isclear="false" isInit="true" fun='teacherSelected'></t:choose>
							
						<span class="Validform_checktip"></span>
						<label class="Validform_label" style="display: none;">负责教师</label>
						
					</td>
				</tr>
			
				<tr>
					<td align="right">
						<label class="Validform_label">
							机床型号:
						</label>
					</td>
					<td class="value">
					 <input id="model" name="model" type="text"  value="${device.model }"
					     	style="width:150px" class="inputxt"   maxlength="30"  onkeypress="specialTextValidate()">
					     	  
  					</td>
				</tr>
				<tr>
					<td align="right">
						<label class="Validform_label">
							规格:
						</label>
					</td>
					<td class="value">
					 <input id="spec" name="spec" type="text"  value="${device.spec }"
					     	style="width:150px" class="inputxt"   maxlength="50"  onkeypress="specialTextValidate()">
					     	  
  					</td>
				</tr>
				 
			</table>
		</t:formvalid>
		<script>
		
		
		$(document).ready(function(){
  			
			var id = $('#id').val();
			if(id.length < 10 && w.currentModDevice != undefined){ //修改未保存的信息，需要从内存中读取
				var d = w.currentModDevice;
				$('#machineName').val(d.machineName);
				$('#id').val(d.id);
				$('#machineNo').val(d.machineNo);
				$('#model').val(d.model);
				$('#spec').val(d.spec);	 
				$('#realName').val(d.teacherName);
			}
		});
		
		//根据form表单内容，获取staff对象
		function getDevice(){
			
			var teacherId = $('#teacherId').val();
			var teacherNo = $('#teacherNo').val();
			var teacherName = $('#realName').val();
			
			var staff = {
					machineNo:$('#machineNo').val(),
					id:$('#id').val(),
					machineName:$('#machineName').val(),
					model:$('#model').val(),
					spec:$('#spec').val(),
					teacherId:teacherId,
					teacherName:teacherName,
					teacherNo:teacherNo
			}
		
			return staff;
		}
		
		function teacherSelected(iframe){
	 		var name =  iframe.getteacherListSelections("realName")[0];
	 		var number = iframe.getteacherListSelections("staffNo")[0];
	 		
	 		if(name.length > 0){
	 			$('#realName').val(name+"("+number+")");
	 			$('#teacherNo').val(number);
	 		} 
	 	}
		</script>
 </body>
 